<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/7/11 0011
 * Time: 15:42
 */

namespace api\storage\model;


use think\Model;

class MachineModel extends Model
{
    protected $table = "smt_machine";
    protected $pk = "uuid";

    /***
     * @param $where
     * @return mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * @throws \think\Exception
     * 根据条件寻找机器信息
     */
    public function findMachineInfo($where)
    {
        $result = $this
            ->where($where)
            ->find();
        return $result;
    }

    /**
     * @param $where
     * @param $update
     * @return MachineModel
     * 更新机器信息
     */
    public function updateMachine($where,$update){
        $result = $this
            ->where($where)
            ->update($update);
        return $result;
    }

    /***
     * @param $where
     * @return false|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * 获取符合条件的多条机器信息
     */
    public function queryMachineInfo($where){
        $result = $this->where($where)
            ->select();
        return $result;
    }


}